<?php

// Site Info
$site_name  = 'Hotec Hotel';
$site_email = 'shrimp2t@gmail.com'; // kienpc81089@gmail.com

if(isset($_POST['reservation_email'])){
	$reservation_name         = $_POST['reservation_name'];
	$reservation_address      = $_POST['reservation_address'];
	$reservation_email        = $_POST['reservation_email'];
	$reservation_type         = $_POST['reservation_type'];
	$reservation_adults       = $_POST['reservation_adults'];
	$reservation_children     = $_POST['reservation_children'];
	$reservation_arrival      = $_POST['reservation_arrival'];
	$reservation_departure    = $_POST['reservation_departure'];
	$reservation_phone        = $_POST['reservation_phone'];
	$reservation_requirements = $_POST['reservation_requirements'];
    $contact_email = $reservation_email;

	$reservation_name         = "Name: $reservation_name <br />";
	$reservation_address      = "Address: $reservation_address <br />";
	$reservation_email        = "Email:  $reservation_email <br />";
	$reservation_type         = "Reservation Room Type: $reservation_type <br />";
	$reservation_adults       = "No. of adults: $reservation_adults <br />";
	$reservation_children     = "No. of children: $reservation_children <br />";
	$reservation_arrival      = "Arrival Date: $reservation_arrival <br />";
	$reservation_departure    = "Departure Date: $reservation_departure <br />";
	$reservation_phone        = "Phone Number: $reservation_phone <br />";
	$reservation_requirements = "Special Requirements: <br /> $reservation_requirements <br />";

	$to = $site_email;
	$subject = "You have a new reservation from ".$site_name;
	$header  = 'MIME-Version: 1.0' . "\r\n";
	$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
	$header .= 'From:'.$contact_email. " \r\n";
	$message = "
		You have a new reservation request! <br />
		$reservation_name
		$reservation_address
		$reservation_email
		$reservation_type
		$reservation_adults
		$reservation_children
		$reservation_arrival
		$reservation_departure
		$reservation_phone
		$reservation_requirements
	";

	// Send Mail
	if(@mail($to,$subject,$message,$header)) {
		$send = true;
	} else {
		$send = false;
	}

	if(isset($_POST['ajax'])){
		if($send)
			echo 'success';
		else
			echo 'error';
	}
}
